package com.cnswhy.cloud.server.core.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cnswhy.cloud.common.core.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.Length;

import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import com.cnswhy.cloud.server.common.entity.enumeration.OrderReportType;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 
 * </p>
 *
 * @author cnswhy
 * @since 2021-03-22
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("t_order_report")
@ApiModel(value = "OrderReport", description = "")
@AllArgsConstructor
public class OrderReport extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 清算日期
     */
    @ApiModelProperty(value = "清算日期")
    @Length(max = 20, message = "清算日期长度不能超过20")
    @TableField(value = "sett_date", condition = LIKE)
    @Excel(name = "清算日期")
    private String settDate;

    /**
     * 汇总类型 #OrderReportType{CPS_ORDER:商家收款;IOTCL:充电线;}
     */
    @ApiModelProperty(value = "汇总类型 #OrderReportType{CPS_ORDER:商家收款;IOTCL:充电线;}")
    @TableField("order_report_type")
    @Excel(name = "汇总类型 #OrderReportType{CPS_ORDER:商家收款;IOTCL:充电线;}", replace = {"商家收款_CPS_ORDER", "充电线_IOTCL",  "_null"})
    private OrderReportType orderReportType;

    /**
     * 交易金额
     */
    @ApiModelProperty(value = "交易金额")
    @TableField("trans_amt")
    @Excel(name = "交易金额")
    private Long transAmt;

    /**
     * 交易笔数
     */
    @ApiModelProperty(value = "交易笔数")
    @TableField("trans_count")
    @Excel(name = "交易笔数")
    private Long transCount;

    /**
     * 成功笔数
     */
    @ApiModelProperty(value = "成功笔数")
    @TableField("success_count")
    @Excel(name = "成功笔数")
    private Long successCount;

    /**
     * 成功比例
     */
    @ApiModelProperty(value = "成功比例")
    @TableField("success_rate")
    @Excel(name = "成功比例")
    private Long successRate;


    @Builder
    public OrderReport(Long id, LocalDateTime createTime, LocalDateTime updateTime, Long updateUser, Long createUser, 
                    String settDate, OrderReportType orderReportType, Long transAmt, Long transCount, Long successCount, Long successRate) {
        this.id = id;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.updateUser = updateUser;
        this.createUser = createUser;
        this.settDate = settDate;
        this.orderReportType = orderReportType;
        this.transAmt = transAmt;
        this.transCount = transCount;
        this.successCount = successCount;
        this.successRate = successRate;
    }

}
